import us.codecraft.webmagic.Spider;

/**
 * Created by linkai on 17-5-1.
 */
public class SpiderControl {
    public static void main(String[] args){
        String cityFirstPageUrl="http://www.hdb.com/%s/0-0-2-0-%s";
        String[] cityPinyinList=CityUtil.getHotCityPinyinList();
        for (int i = 0; i < cityPinyinList.length; i++) {
         Spider.create(
                 new SpiderProcessor(cityPinyinList[i]))
                 .addUrl(String.format(cityFirstPageUrl,cityPinyinList[i],1))
                 .addPipeline(new MysqlPipeline())
                 .thread(5)
                 .run();
        }
    }
}
